package com.cooksys.film_rental.model;

// Generated May 24, 2013 9:46:57 AM by Hibernate Tools 4.0.0

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToOne;
import javax.persistence.PrimaryKeyJoinColumn;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Parameter;

/**
 * User generated by hbm2java
 */
@Entity
@Table(name = "user", catalog = "sakila", uniqueConstraints = @UniqueConstraint(columnNames = "user_id"))
public class User implements java.io.Serializable {

	private short customerId;
	private Customer customer;
	private String userId;
	private String password;

	public User() {
	}

	public User(Customer customer, String userId) {
		this.customer = customer;
		this.userId = userId;
	}

	public User(Customer customer, String userId, String password) {
		this.customer = customer;
		this.userId = userId;
		this.password = password;
	}

	@GenericGenerator(name = "generator", strategy = "foreign", parameters = @Parameter(name = "property", value = "customer"))
	@Id
	@GeneratedValue(generator = "generator")
	@Column(name = "customer_id", unique = true, nullable = false)
	public short getCustomerId() {
		return this.customerId;
	}

	public void setCustomerId(short customerId) {
		this.customerId = customerId;
	}

	@OneToOne(fetch = FetchType.EAGER)
	@PrimaryKeyJoinColumn
	public Customer getCustomer() {
		return this.customer;
	}

	public void setCustomer(Customer customer) {
		this.customer = customer;
	}

	@Column(name = "user_id", unique = true, nullable = false, length = 45)
	public String getUserId() {
		return this.userId;
	}

	public void setUserId(String userId) {
		this.userId = userId;
	}

	@Column(name = "password", length = 15)
	public String getPassword() {
		return this.password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

}
